const jwt = require('jsonwebtoken')
const {secret} = require('../config')

module.exports = {
    sign:(data,expiresIn)=>{
        return jwt.sign(data,secret,{ expiresIn: expiresIn ,algorithm:'HS256'})
    },
    verify:(token)=>{
        try {
            return jwt.verify(token,secret)
        } catch (error) {
            return false
        }
    }
}